//
//  UserInfoModel.m
//  WULIHH
//
//  Created by tang on 16/4/13.
//  Copyright © 2016年 tang. All rights reserved.
//

#import "UserInfoModel.h"
#import "Header.h"

@implementation UserInfoModel


//获取token
+ (NSString *)tokenString
{
    if ([[NSUserDefaults standardUserDefaults] valueForKey:@"user"])
    {
        NSString *string = [NSString stringWithFormat:@"%@", [[[[NSUserDefaults standardUserDefaults] valueForKey:@"user"] valueForKey:@"data"] valueForKey:@"token"]];
        return string;

    }
    else
    {
        
        return @"";

    }
    
 }


//获取名字
+ (NSString *)nameString
{
//    NSLog(@"%@", [[NSUserDefaults standardUserDefaults] valueForKey:@"user"]);
    
    NSString *string = [NSString stringWithFormat:@"%@", [[[[[NSUserDefaults standardUserDefaults] valueForKey:@"user"] valueForKey:@"data"] valueForKey:@"user"] valueForKey:@"username"]];
    return string;

}



//获取id
+ (NSString *)userIDString
{
    NSString *string = [NSString stringWithFormat:@"%@", [[[[[NSUserDefaults standardUserDefaults] valueForKey:@"user"] valueForKey:@"data"] valueForKey:@"user"] valueForKey:@"id"]];
    return string;
}





//获取关注明星书
+ (NSString *)starString
{
    //    NSLog(@"%@", [[NSUserDefaults standardUserDefaults] valueForKey:@"user"]);
    
    NSString *string = [NSString stringWithFormat:@"%@", [[[[[NSUserDefaults standardUserDefaults] valueForKey:@"user"] valueForKey:@"data"] valueForKey:@"user"] valueForKey:@"followStarCount"]];
    return string;
    
}







//获取粉丝数
+ (NSString *)fllowString
{
    //    NSLog(@"%@", [[NSUserDefaults standardUserDefaults] valueForKey:@"user"]);
    
    NSString *string = [NSString stringWithFormat:@"%@", [[[[[NSUserDefaults standardUserDefaults] valueForKey:@"user"] valueForKey:@"data"] valueForKey:@"user"] valueForKey:@"followUserCount"]];
    return string;
    
}

//获取头像
+ (NSString *)imageString
{
    //    NSLog(@"%@", [[NSUserDefaults standardUserDefaults] valueForKey:@"user"]);
    
    NSString *string = [NSString stringWithFormat:@"%@", [[[[[NSUserDefaults standardUserDefaults] valueForKey:@"user"] valueForKey:@"data"] valueForKey:@"user"] valueForKey:@"iconUrl"]];
    return string;
    
}


//获取头像
+ (NSData *)imageHeadData
{
//    NSData *data = nil;
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory2 = [paths objectAtIndex:0]; //path数组里貌似只有一个元素
    //字符串拼接得到文件完整路径
    NSString *filestr = @"/MyImage.jpg";
    NSString *newstr = [documentsDirectory2 stringByAppendingString:filestr];
//    NSLog(@"完整路径是:%@",newstr);
    
    NSData *dd = [NSData dataWithContentsOfFile:newstr];
    return dd;
}



//获取性别
+(NSString *)SexString{

    NSString *string = [NSString stringWithFormat:@"%@",[[[[[NSUserDefaults standardUserDefaults]valueForKey:@"user"]valueForKey:@"data"]valueForKey:@"user"]valueForKey:@"sex"]];
    return string;

}

+(NSString *)UserString{
    
    NSString * string = [NSString stringWithFormat:@"%@",[[[[[NSUserDefaults standardUserDefaults]valueForKey:@"user"] valueForKey:@"data"]valueForKey:@"user"]valueForKey:@"username"]];

    return string;
}


+ (NSString *)UserAge{

    
    NSString * string = [NSString stringWithFormat:@"%@",[[[[[NSUserDefaults standardUserDefaults]valueForKey:@"user"] valueForKey:@"data"]valueForKey:@"user"]valueForKey:@"age"]];
    
    return string;

}
@end
